import request from '@/utils/request'

// 获取所有角色列表
export const getRoles = params => request({
  url: '/sys/role',
  params
})

// 根据ID删除角色
export const delRole = id => request({
  url: `/sys/role/${id}`,
  method: 'DELETE'
})

// 添加角色
export const addRole = data => request({
  url: '/sys/role',
  method: 'POST',
  data
})

// 根据ID获取角色详情
export const getRole = id => request({
  url: `/sys/role/${id}`
})

// 根据ID更新角色
export const setRole = (id, data) => request({
  url: `/sys/role/${id}`,
  method: 'PUT',
  data
})

// 给员工分配角色
export const assignRoles = data => request({
  url: '/sys/user/assignRoles',
  method: 'PUT',
  data
})

// 给角色分配权限
export const assignPrem = data => request({
  url: '/sys/role/assignPrem',
  method: 'PUT',
  data
})
